package com.fdb.efp.nls.common.constant.wsd;

import java.util.stream.Stream;

/**
 * 需求编号:
 * 问题编号:
 * 开发人员: caoxin
 * 创建日期:2019/7/17
 * 功能描述:插槽配置
 * 修改日期:2019/7/17
 * 修改描述:
 */
public enum WSDAdaptedSoltEnum {
    SOLT_WHITELIST_AC_RULE("890092_LHD", "wsdCreditServiceAccess", "授信审批规则服务", "wsdCreditAccessService", "1", 1),
    SOLT_CUS_DOCUMENTATION("890092_LHD", "wsdCusServiceAccess", "客户建档服务", "wsdCusDocumentService", "1", 2),
    SOLT_GENERATE_LIMIT("890092_LHD", "wsdLimitServiceAccess", "生成额度信息服务", "wsdLimitGenerateService", "1", 3);

    // 产品ID
    private String prdId;
    // 插槽代码
    private String soltCode;
    // 插槽名称
    private String soltName;
    // 插槽服务类
    private String soltService;
    // 插槽阶段类
    private String soltStage;
    // 插槽顺序
    private int soltOrder;

    public String getPrdId() {
        return prdId;
    }

    public String getSoltCode() {
        return soltCode;
    }

    public String getSoltName() {
        return soltName;
    }

    public String getSoltService() {
        return soltService;
    }

    public String getSoltStage() {
        return soltStage;
    }

    public int getSoltOrder() {
        return soltOrder;
    }

    private WSDAdaptedSoltEnum(String prdId, String soltCode, String soltName, String soltService, String soltStage, int soltOrder) {
        this.prdId = prdId;
        this.soltCode = soltCode;
        this.soltName = soltName;
        this.soltService = soltService;
        this.soltStage = soltStage;
        this.soltOrder = soltOrder;
    }

    public static WSDAdaptedSoltEnum parse(String prdId, String soltCode) {
        return Stream.of(WSDAdaptedSoltEnum.values()).filter(value -> value.prdId.equals(prdId) && value.soltCode.equals(soltCode))
                .findFirst().orElseThrow(RuntimeException::new);

    }

    public boolean validateSoltService(String soltName, String soltService, String soltStage, int soltOrder) {
        return this.soltName.equals(soltName) && this.soltService.equals(soltService) && this.soltStage.equals(soltStage) && this.soltOrder == soltOrder;
    }
}
